Modular Monad Transformers

نویسنده

  • Mauro Jaskelioff
چکیده

During the last two decades, monads have become an indispensable tool for structuring functional programs with computational effects. In this setting, the mathematical notion of a monad is extended with operations that allow programmers to manipulate these effects. When several effects are involved, monad transformers can be used to build up the required monad one effect at a time. Although this seems to be modularity nirvana, there is a catch: in addition to the construction of a monad, the effect-manipulating operations need to be lifted to the resulting monad. The traditional approach for lifting operations is nonmodular and ad-hoc. We solve this problem with a principled technique for lifting operations that makes monad transformers truly modular.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Modular construction of Bayesian inference algorithms

We propose a set of abstractions to modularize implementation of Bayesian inference algorithms. We provide a proof-of-concept implementation as a Haskell library and demonstrate on several examples how it simplifies implementation of Monte Carlo algorithms. Our technique is based on a method for modular construction of interpreters using monad transformers and is applicable generically to proba...

متن کامل

Monad Transformers as Monoid Transformers

The incremental approach to modular monadic semantics constructs complex monads by using monad transformers to add computational features to a preexisting monad. A complication of this approach is that the operations associated to the pre-existing monad need to be lifted to the new monad. In a companion paper by Jaskelioff, the lifting problem has been addressed in the setting of system Fω. Her...

متن کامل

Building inference algorithms from monad transformers

We show how to decompose popular inference algorithms into a set of simple, reusable building blocks corresponding to monad transformers. We define a collection of such building blocks and implement them in Haskell producing a library for constructing inference algorithms in a modular fashion. We are also working towards formalizing those concepts as monadic denotational semantics for inference...

متن کامل

Lifting of operations in modular monadic semantics

Monads have become a fundamental tool for structuring denotational semantics and programs by abstracting a wide variety of computational features such as side-effects, input/output, exceptions, continuations and non-determinism. In this setting, the notion of a monad is equipped with operations that allow programmers to manipulate these computational effects. For example, a monad for side-effec...

متن کامل

Compilation as Metacomputation: Binding Time Separation in Modular Compilers (ex Tende D Abstract)

This paper presents a modular and extensible style of language speciication based on meta-computations. This style uses two monads to factor the static and dynamic parts of the speci-cation, thereby staging the speciication and achieving strong binding-time separation. Because metacomputations are deened in terms of monads, they can be constructed modularly and ex-tensibly using monad transform...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009